VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsProveedor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit

      'Proveedor del pesaje actual.
Private loc_Codigo                   As Integer
Private loc_Nombre                   As String
Private loc_Albaran                  As String
Private loc_Filtro                   As String
Private loc_RegistroSanitario        As String

Public Event Seleccionado(ByVal Codigo As Integer)

Public Property Get Albaran() As String
  Albaran = loc_Albaran
End Property

Public Property Get Codigo() As Integer
  Codigo = loc_Codigo
End Property

Public Property Get Nombre() As String
  Nombre = loc_Nombre
End Property

Public Property Get Filtro() As String
    Filtro = loc_Filtro
End Property

Public Property Get RegistroSanitario() As String
    RegistroSanitario = loc_RegistroSanitario
End Property

Public Property Let Codigo(ByVal vData As Integer)
    loc_Codigo = vData
    GetDatos loc_Codigo, loc_Nombre, loc_RegistroSanitario
    RaiseEvent Seleccionado(loc_Codigo)
End Property

Public Property Let Albaran(ByVal vData As String)
  loc_Albaran = vData
End Property

Public Property Let Filtro(ByVal vData As String)
    loc_Filtro = vData
End Property

Private Sub Class_Initialize()
    loc_Codigo = -1
    loc_Nombre = vbNullString
    loc_Albaran = vbNullString
    loc_RegistroSanitario = vbNullString
    loc_Filtro = "Nombre"
End Sub

Public Sub Clear()
    Class_Initialize
End Sub

Private Sub GetDatos(ByVal codProveedor As Integer, Nombre As String, RegSanit As String)
Dim rsProveedor As ADODB.Recordset

    Set rsProveedor = Cn_Local.Execute("SELECT Nombre, Registro_Sanitario FROM Proveedores WHERE Codigo=" & codProveedor)

    With rsProveedor
        If Not .EOF Then
          Nombre = .Fields("Nombre") & ""
          RegSanit = .Fields("Registro_Sanitario") & ""
        End If
    End With

    Set rsProveedor = Nothing


End Sub
